Skip to content

fix(pl-client): an EphStdMap is never final in the tree - #2012

Open
vgpopov wants to merge 1 commit into
mainfrom
vp/map-final-after-inputs
Open

vgpopov wants to merge 1 commit into
mainfrom
vp/map-final-after-inputs

Conversation

@vgpopov

@vgpopov vgpopov commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Outcome

  • A reader of a synchronized tree sees an error that reaches an EphStdMap after the map is ready.
  • The test "a failed import fails the effect" can pass on the k8s backend. There, the import of a missing library file fails after the v2 effect map is ready. This PR does not remove the k8s skip that Skip two k8s-failing tests #2002 adds; that is a separate step after this lands.
  • The tree fetches each EphStdMap on every poll. The benchmark below shows the cost.

Cause

The client finality table held a ready EphStdMap final, so the tree never fetched it again. Backend "ready" asks only that every input points to a resource with a final status. Work below that resource can still fail. The core then lifts the error up to the map after ready, with no controller. On localfs the index of a missing file fails in milliseconds, before the client reads the map. On k8s it fails later, and the poll of #2008 read "no error" for 3 × 60 s.

History: 7c0d4c8 (2024-10-10) made EphStdMap final at ready; before it, nothing in the tree was final. #1874 gave the row the reason "its inputs are final at ready, and no controller fills it afterwards". daa13ed (2026-11-05) made the v2 effect an EphStdMap. Full analysis: https://gist.github.com/vgpopov/6536ec7922802a34644da097c5efd0ac

Change

  • StrictFinality: EphStdMap moves from the "final at ready" group to a never row. The project stop rules are generated from the table, so the backend no longer stops a walk at a ready EphStdMap.
  • The header of the finality tables lists the late error as a third write after final, next to the data-loss cascade and hasOriginalListeners. The shared reason of the "final at ready" rows now says that such a type does not show a late error.
  • StdMap, StdMapSlash, PFrame, and the other rows of that group keep the old rule. They can miss a late error the same way; that stays for a follow-up.

Tests

  • pl-tree, live: "an error that reaches an ephemeral map after it is ready gets into the tree". It passes on backend 5.0.2. With the old row it fails: "no error" for 20 s, the k8s symptom.
  • pl-client and pl-middle-layer unit tests: the finality table and the generated stop rules.

Benchmark

PL_TREE_BENCH=1 pnpm exec vitest run src/delta_benchmark.test.ts in lib/node/pl-tree, local backend 5.0.2, two runs with the same numbers. A new arm seeds 12 EphStdMaps × 6 json values and runs every algorithm with the old row and with the new one. Resources fetched over a cold load and 3 polls:

Arm Resources, old → new Bytes, old → new Seeds sent, old → new
client-bfs prune=off 100 → 136 182794 → 182938 0 → 0
backend-streaming prune=off 100 → 136 182842 → 182986 0 → 0
backend-delta prune=off 100 → 100 182890 → 183034 4 → 40

The extra 36 fetches are 12 maps × 3 polls. A map carries no data, so the bytes grow by 144. The struct arm matches main exactly, and every arm sees all 3 changes. The cost in a real project depends on how many EphStdMaps its tree holds; I did not measure a real project.

🤖 Generated with Claude Code

A ready EphStdMap was final, so the tree stopped re-reading it. A map is
ready once its entries resolve to resources, not once those resources
settle. An entry that fails later puts its error on the map after ready,
and the tree never saw it. The v2 effect hit this: on the k8s backend the
import of a missing library file failed after the effect map was ready,
and "a failed import fails the effect" read no error for minutes.

The map is now never final. The delta benchmark gets an arm of
ephemeral maps that compares the old row with the new one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@greptile-apps

greptile-apps Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Automatic reviews are disabled for this repository. Configure in Code Review Settings.

@changeset-bot

changeset-bot Bot commented Nov 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d3052ea

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@milaboratories/pl-client Patch
@milaboratories/pl-model-backend Patch
@milaboratories/pl-errors Patch
@milaboratories/pl-tree Patch
@milaboratories/pl-drivers Patch
@milaboratories/pl-middle-layer Patch
@platforma-sdk/pl-cli Patch
@platforma-sdk/test Patch
@platforma-sdk/tengo-builder Patch
@platforma-sdk/block-tools Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
3877 1 3876 27
View the top 1 failed test(s) by shortest run time
src/v2/effect.test.ts > a workflow that imports nothing has an effect that is an empty, final map with no imports section
Stack Traces | 2.56s run time
AssertionError: expected false to equal true

- Expected
+ Received

- true
+ false

 ❯ src/v2/effect.test.ts:169:7

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant